package o2o.delivery.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @author Jahnke【1029777564@qq.com】
 * @ClassName DeliveryOrderTask
 * @Description:
 * @date 2021/1/30 9:20
 * @Version 1.0
 */
@Service
public class DeliveryOrderTask {

    @Autowired
    private DeliveryOrderService deliveryOrderService;

    // 订单回调通知
    @Async
    public void sendNotify(String orderNo) {
        if (orderNo.endsWith("elm") || orderNo.endsWith("mt") || orderNo.endsWith("oth")) {
            String no = orderNo.substring(0, orderNo.lastIndexOf("_"));
            String source = orderNo.substring(orderNo.lastIndexOf("_") + 1);
            deliveryOrderService.sendNotify(source, no);
        }
    }

}
